package action.admin;


import org.junit.After;
import servletunit.struts.MockStrutsTestCase;
import org.junit.Before;

public class TestAdminConnexionAction2 extends MockStrutsTestCase {

	@Before
	public void setUp() throws Exception {
		super.setUp();
	}

	@After
	public void tearDown() throws Exception {
	}

	public void testAdminOK() {
		
		setRequestPathInfo("/AdminConnexionAction");
		addRequestParameter("adresseEmail","superman@u-paris10.fr");
		addRequestParameter("motDePasseConnexion","superman");
		actionPerform();
		verifyForward("success");

		assertEquals(true, getSession().getAttribute("isAdmin"));


	}
	
	public void testNonAdmin() {
		
		setRequestPathInfo("/AdminConnexionAction");
		addRequestParameter("adresseEmail","superman@u-paris10.fr");
		addRequestParameter("motDePasseConnexion","superman2");
		actionPerform();
		verifyInputForward();

		assertEquals(null, getSession().getAttribute("isAdmin"));

	}
}
